At 10:20 AM 6/26/98, Joao Paulo Felix wrote:
>Hello there,
>
>I have the following fields description, info and title.
>Is there a PostgreSQL query to update more than one field at the same
>time?
>
>Right now I have the following (I am using it with PHP, so please
>desregard its code):
>
>pg_Exec($conn, "UPDATE options SET description = '$description'
> WHERE product = '$product' AND title = '$old_title';");
>
>pg_Exec($conn, "UPDATE options SET info = '$info'
> WHERE product = '$product' AND title = '$old_title';");
>
>pg_Exec($conn, "UPDATE options SET title = '$title'
> WHERE product = '$product' AND title = '$old_title';");
Hey! One I can answer!
typos may exist:
pg_Exec($conn, "UPDATE options SET description = '$description', info =
'$info', title = '$title' WHERE product = '$product' AND title =
'$old_title'");
Basically, you can have as many ", field = $value" entries as you like.
I also purposefully stripped off the ';' inside the string because
PostgreSQL doesn't need it, and some other database backend barfs when you
use it, so if you ever want to port, you don't want the ';' as part of the
SQL. Capiche?
--
--
-- "TANSTAAFL" Rich lynch@lscorp.com